package maildto

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/util/gconv"
	"xr-game-server/entity"
)

type GetRoleMailReq struct {
	g.Meta `path:"/role/mail/get" method:"post" tags:"邮件" summary:"获取角色邮件"`
}
type RoleMailDto struct {
	ID          string               `json:"id"`
	CreatedAt   string               `json:"createdAt"`
	IsRead      bool                 `json:"isRead"`
	IsReceived  bool                 `json:"isReceived"`
	Type        int32                `json:"type"`
	Attachments []*entity.Attachment `json:"attachments"`
}

func NewRoleMailDto(mail *entity.RoleMail, attachments []*entity.Attachment) *RoleMailDto {
	ret := &RoleMailDto{}
	gconv.Struct(mail, ret)
	ret.Attachments = attachments
	ret.CreatedAt = mail.CreatedAt.Format("2006-01-02 15:04:05")
	return ret
}
